/**
 *PHP V8 Library
 *Copyright(C) Ins<Instance@9.cn> www.narrow-world.com
 */
extern "C"{
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
}
#include "phpv8_helper.h"


void phpv8_error(int level, const char *format, ...){
  const char *pre = "[PHPV8]";
  int fmt_total = strlen(format) + strlen(pre);
  char fmt[fmt_total + 1];
  memset(fmt, 0, fmt_total + 1);
  snprintf(fmt, fmt_total + 1, "[PHPV8]%s", format);
  char buf[2000] = {0};
  va_list args;
  va_start(args, format);
  vsnprintf(buf, 2000, fmt, args);
  va_end(args);
  php_error_docref(NULL TSRMLS_CC, level, buf);
}
